package com.hulk.boot.config.condition;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

import com.google.common.base.Objects;

/**
 * @author cmt
 *
 */
public class ProfileSingleCondition implements Condition {
	
	private static final String mode = "spring.redis.mode";
	
	private static final String redisMode = "single";

	@Override
	public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
		
		
		if(Objects.equal(redisMode, context.getEnvironment().getProperty(mode))){
			return true;
		}
		
		return false;
	}
}